package com.pl.config.security;

import javax.servlet.http.HttpServletRequest;

import org.springframework.security.web.authentication.WebAuthenticationDetails;

/**
 * class name:MyWebAuthenticationDetails <BR>
 * class description: 登录表单扩展 <BR>
 * Remark: <BR>
 * @version 1.00 2019年11月22日
 * @author wangjian
 */
public class MyWebAuthenticationDetails extends WebAuthenticationDetails{
	
	/**  
	 * define a field serialVersionUID which type is long
	 */
	private static final long serialVersionUID = -842800010025276578L;
	
	private final String imageCode;
	
	public String getImageCode() {
        return this.imageCode;
    }

	public MyWebAuthenticationDetails(HttpServletRequest request) {
		super(request);
		// 图形验证码
		imageCode = request.getParameter("imageCode");
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(super.toString()).append(": ");
		sb.append("RemoteIpAddress: ").append(this.getRemoteAddress()).append("; ");
		sb.append("SessionId: ").append(this.getSessionId());
		sb.append("imageCode: ").append(this.getImageCode());

		return sb.toString();
	}
}
